﻿namespace Service.EF
{
    #region using

    using System.Data.Entity;
    using Model;

    #endregion

    internal class TodoContext : DbContext
    {
        #region Public Properties

        public DbSet<Todo> Todos { get; set; }

        #endregion

        #region Methods

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Todo>()
                        .HasKey(x => x.Id)
                        .Property(x => x.Title).IsRequired().IsVariableLength().HasMaxLength(255);
        }

        #endregion
    }
}